import requestblock from '@/utils/requestblock'

export function getBlockInfoNew(pageSize, pageNum) {
  let data = {
    "pageNum": pageNum,
    "pageSize": pageSize
  };

  return requestblock({
    url: '/baseInfo/blockNewPages',
    method: 'post',
    data: JSON.stringify(data),
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}

// 区块高度
export function getHeightInf() {
  return requestblock({
    method: 'post',
    url: '/baseInfo/blockNum'
  })
}

export function getHeightBytime(date) {
  return requestblock({
    method: 'post',
    url: '/baseInfo/BlockCountByTime',
    data: JSON.stringify(date),
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}
//合约数量
export function getChaincodeNumber(date) {
  return requestblock({
    method: 'post',
    url: '/baseInfo/chaincodeDistinctNumByTime',
    data: JSON.stringify(date),
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}
//节点数量
export function getNodeNumber(date) {
  return requestblock({
    method: 'post',
    url: '/baseInfo/nodeNumByTime',
    data: JSON.stringify(date),
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}
//交易数据
export function getTransactionNumber(date) {

  return requestblock({
    method: 'post',
    url: '/baseInfo/TransactionCountByTime',
    data: JSON.stringify(date),
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}

export function getOrgTransaction() {
  return requestblock({
    method: 'post',
    url: '/baseInfo/TransactionCountByOrgProportion'
  })
}
export function getQueryInfo() {
  return requestblock({
    method: 'post',
    url: '/baseInfo/querytop5',
    data: '',
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}

export function getInvokeInfo() {
  return requestblock({
    method: 'post',
    url: '/baseInfo/invoketop5',
    data: '',
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}

export function invokeBlockNumber() {
  return requestblock({
    method: 'post',
    url: '/baseInfo/invokeBlockNumber',
    data: '',
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}


export function peerTimeInfo() {
  return requestblock({
    method: 'post',
    url: '/baseInfo/peerTimeInfo',
    data: '',
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}

export function peerInfo(time) {
  let data = {
    "timeStr": time
  }
  return requestblock({
    method: 'post',
    url: '/baseInfo/peerDWMTimeInfo',
    data: JSON.stringify(data),
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}

export function channelBlockInfo(date) {

  return requestblock({
    method: 'post',
    url: '/baseInfo/BlockTimeCountByChannelProportion',
    data: JSON.stringify(date),
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}


export function getDWMOrgTransaction(date) {
  return requestblock({
    method: 'post',
    url: '/baseInfo/TransactionCountByDWMOrgProportion',
    data: JSON.stringify(date),
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}
export function ChannelList() {
  return requestblock({
    method: 'post',
    url: '/baseInfo/ChannelList',
    data: '',
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}
  export function blockNewPagesByChannel(pageSize,pageNum,channel) {
    let data = {
      "pageNum": pageNum,
      "pageSize": pageSize,
      "channelName":channel
    };
    return requestblock({
      method: 'post',
      url: '/baseInfo/blockNewPagesByChannel',
      data: JSON.stringify(data),
      headers: {
        "Content-Type": "application/json;charset=UTF-8"
      },
    })
}